// 新建编辑文档
export const editWpsDoc = function (fileInfo, controlBtns) {
  this.fileInfo = fileInfo
  this.controlBtns = controlBtns
  this.editUrl = ''
  this.wpsDocObject = {}
  this.wpsAppObject = {}
}
// 创建在线编辑对象
editWpsDoc.prototype.builder = async function () {
  const editRes = await getWPSEditUrl(this.fileInfo)
  if (editRes.code == 200) {
    this.editUrl = editRes.data.link
    this.wpsDocObject = WebOfficeSDK.config({
      url: this.editUrl, // 该地址需要对接方服务端提供，形如 https://wwo.wps.cn/office/p/xxx
      mount: document.getElementById('wpsIframeDoc'),
    })

    // 需要等待 jssdk ready 之后再调用高级 API
    await this.wpsDocObject.ready()
    this.wpsAppObject = await this.wpsDocObject.Application

    return this.wpsDocObject
  }else{
    return null
  }
}
